//
//  ZRUserAccountModel.swift
//  XJ8XWB
//
//  Created by 中二 on 2016/10/26.
//  Copyright © 2016年 中二. All rights reserved.
//

import UIKit

class ZRUserAccountModel: NSObject , NSCoding{
     required init?(coder aDecoder: NSCoder) {
        super.init()
        self.yy_modelInit(with: aDecoder)
    }

    
    //用户授权的唯一票据
    var access_token:String?
    
    //生命周期  秒数
    var expires_in:TimeInterval = 0 {
        
        didSet{
            
            expires_Date = Date().addingTimeInterval(expires_in)
        }
        
    }
    
    /// 授权用户的UID
    var uid: String?
    /// 用户头像
    var avatar_large: String?
    /// 用户昵称
    var screen_name: String?
    /// 过期时间
    var expires_Date: Date?
    
    
    override init() {
        super.init()
    }
    
    func encode(with aCoder: NSCoder) {
        self.yy_modelEncode(with: aCoder)
    }
    
    override var description: String{
        let keys = ["access_token", "expires_Date", "uid", "avatar_large", "screen_name"]
        return dictionaryWithValues(forKeys: keys).description
    }
    
}
